

		* APPENDIX 14: Did Those who Continued to Identify with the Labour Party after the Party Position Change Adopt more Left-Wing Positions?
		
		cd "$data"
		use "data1.dta", clear 
		
			

gen consistentlabour_after = 1 if pid6==2 & pid7==2 & pid8==2 & pid9==2 & pid10==2 & pid11==2 & pid12==2
replace consistentlabour_after = 0 if pid6==0


gen centerleftright = .
replace centerleftright = 0 if leftright6==1
replace centerleftright = 1 if leftright6==0
replace centerleftright = 2 if leftright6==2

label define centerleftright_labels 0"center" 1"left-wing" 2"right-wing"
label values centerleftright centerleftright_labels


eststo M1: regress shiftw6w7_LR i.consistentlabour_after, robust
eststo M2: regress shiftw6w7_LR i.consistentlabour_after##i.centerleftright, robust



esttab M1 M2 using "${tables}/Table14_1.tex" , b(3) se(3) nogap replace


eststo M2: regress shiftw6w7_LR i.consistentlabour_after##i.centerleftright, robust
margins, at(centerleftright=(0 1 2) consistentlabour_after=0) post
estimates store independent

eststo M2: regress shiftw6w7_LR i.consistentlabour_after##i.centerleftright, robust
margins, at(centerleftright=(0 1 2) consistentlabour_after=1) post
estimates store consistentlabour

coefplot independent consistentlabour, horizontal yline(0) title("change in left-right between wave 6 and wave 7") xline(0, lpattern(dash)) ylabel(1 "center" 2 "left-wing" 3 "right-wing", angle(0)) 
graph save "${figures}/Figure14_1.gph", replace 





*FIGURE 14.2


* FIGURE 12.2: Evolution of left-right placement among weak and strong Labour identifiers


* Create a new folder in the data folder that is named "estimates"

cd "$data"
use "panel.dta", clear 

xtset id vague 

******* consistent Labour  
cd "$data/estimates"

eststo m1: xtreg leftRightW i.vague if pid6==2 & consistentlabour_after==1, fe
margins, at(vague=(1 2 3 4 5 6 7 8 9 10 11 12 15 16 17 18 19 20 21 22 23)) saving(results21, replace)

cd "$data/estimates"
use "results21.dta", clear 

drop _deriv _term _predict _se_margin _statistic _pvalue 

rename _margin b
rename _ci_lb b_lower 
rename _ci_ub b_upper 
rename _at vague_updated // note that wave 1, 13, 14 and 19 are not available. Margins command will jump those and will not show them, the outcome will be as if there is no gaps from 1 to the last, hence use "_at1" variable. 


tsset _at1 
 
twoway (tsline b, lcolor(cranberry%60) lpattern(dash)) (tsline b_lower, lcolor(cranberry%60) lpattern(solid)) (tsline b_upper, lcolor(cranberry%60)), legend(off) xline(6.5, lpattern(solid) lcolor(gs6%70)) tlabel(#30, labels labsize(vsmall) angle(vertical) valuelabel) ttitle("") graphregion(margin(5 5 15 5)) title("") yscale(range(2.5(0.5)3.5)) ytick(2.5 3 3.5) ylabel(2.5 3 3.5)  
graph save "${figures}/Figure14_2.gph",replace 








